package com.neusoft.elmboot.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.neusoft.elmboot.po.Cart;
import com.neusoft.elmboot.service.CartService;

@RestController
@RequestMapping("/Cart")
public class CartController {

	@Autowired
	private CartService cartService;
	
	@RequestMapping(method = RequestMethod.GET)
	public List<Cart> listCart(Cart cart) throws Exception{
		return cartService.listCart(cart);
	}

	@RequestMapping(method = RequestMethod.POST)
	public int saveCart(Cart cart) throws Exception{
		return cartService.saveCart(cart);
	}
	
	@RequestMapping(method = RequestMethod.PUT)
	public int updateCart(Cart cart) throws Exception{
		return cartService.updateCart(cart);
	}
	
	@RequestMapping(method = RequestMethod.DELETE)
	public int removeCart(Cart cart) throws Exception{
		return cartService.removeCart(cart);
	}
}
